#include "tests.h"
#include "Expr.h"
#include "functions.h"
void testOfDiff(const int numberTest, const TestX &);
int main() {
	TestX T(0);
	testOfDiff(0,T);
}
void testOfDiff(const int numberTest, const TestX & T) {
	int nT = 0;
	Expr a("a");
	Expr b("b");
	Expr c("c");
	Expr d("d");
//--- 		
	if (numberTest == ++nT || numberTest == 0) {
		Expr e(0);
		T.test(e.diff(a), "0", __LINE__, nT);
	}
	if (numberTest == ++nT || numberTest == 0) {
		Expr e(-8);
		T.test(e.diff(a), "0", __LINE__, nT);
	}
	if (numberTest == ++nT || numberTest == 0) {
		Expr e(a);
		T.test(e.diff(b), "0", __LINE__, nT);
	}
	if (numberTest == ++nT || numberTest == 0) {
		Expr e(-a);
		T.test(e.diff(b),"0",__LINE__, nT);
	}
	if (numberTest == ++nT || numberTest == 0) {
		Expr e(2*a);
		T.test(e.diff(a), "2", __LINE__, nT);
	}
	if (numberTest == ++nT || numberTest == 0) {
		Expr e(-8*a);
		T.test(e.diff(a), "-8", __LINE__, nT);
	}
	if (numberTest == ++nT || numberTest == 0) {
		Expr e(a);
		T.test(e.diff(a), "1", __LINE__, nT);
	}
	if (numberTest == ++nT || numberTest == 0) {
		Expr e(-a);
		T.test(e.diff(a),"-1",__LINE__, nT);
	}
//--- 		
	if (numberTest == ++nT || numberTest == 0) {
		Expr e(4*a*b);
		T.test(e.diff(a), "4b", __LINE__, nT);
	}
	if (numberTest == ++nT || numberTest == 0) {
		Expr e(-8*a*b);
		T.test(e.diff(b), "-8a", __LINE__, nT);
	}
	if (numberTest == ++nT || numberTest == 0) {
		Expr e(-a/b);
		T.test(e.diff(a), "-1/b", __LINE__, nT);
	}
	if (numberTest == ++nT || numberTest == 0) {
		Expr e(-a*3*b*b/d*c);
		T.test(e.diff(a),"-3b^2c/d",__LINE__, nT);
	}
	if (numberTest == ++nT || numberTest == 0) {
		Expr e(2*a*b + c);
		T.test(e.diff(a), "2b", __LINE__, nT);
	}
	if (numberTest == ++nT || numberTest == 0) {
		Expr e(2*a*b + c*a);
		T.test(e.diff(a), "2b+c", __LINE__, nT);
	}
	if (numberTest == ++nT || numberTest == 0) {
		Expr e(-8*a+3*a*b);
		T.test(e.diff(a), "-8+3b", __LINE__, nT);
	}
	if (numberTest == ++nT || numberTest == 0) {
		Expr e(a^2);
		T.test(e.diff(a), "2a", __LINE__, nT);
	}
	if (numberTest == ++nT || numberTest == 0) {
		Expr e(-a*a*a);
		T.test(e.diff(a),"-3a^2",__LINE__, nT);
	}
	if (numberTest == ++nT || numberTest == 0) {
		Expr e(-8*a*+3*a*b);
		T.test(e.diff(a), "-48ab", __LINE__, nT);
	}
//--- 		
	if (numberTest == ++nT || numberTest == 0) {
		Expr e(a^a);
		T.test(e.diff(a), "a^a(1+Ln(a))", __LINE__, nT);
	}
	if (numberTest == ++nT || numberTest == 0) {
		Expr e((-7*a+b)^3);
		T.test(e.diff(a), "-21(-7a+b)^2", __LINE__, nT);
	}
	if (numberTest == ++nT || numberTest == 0) {
		Expr e(Sin(a^b));
		T.test(e.diff(a), "a^(-1+b)bCos(a^b)", __LINE__, nT);
	}
	if (numberTest == ++nT || numberTest == 0) {
		Expr e((2*a*b+a/c+Cos(a^3))^(-2*a*c+Sin(a)));
		T.test(e.diff(a),"(2ab+a/c+Cos(a^3))^(-2ac+Sin(a))((-2c+Cos(a))Ln(2ab+a/c+Cos(a^3))+(-2ac+Sin(a))(2b+1/c-3a^2Sin(a^3))/(2ab+a/c+Cos(a^3)))",__LINE__, nT);
	}
	if (numberTest == ++nT || numberTest == 0) {
		Expr e(3^(-a));
		T.test(e.diff(a), "-Ln(3)/3^a", __LINE__, nT);
	}
	if (numberTest == ++nT || numberTest == 0) {
		Expr e(Tg(-a));
		T.test(e.diff(a), "-(Cos(-a)^(-2))", __LINE__, nT);
	}
	if (numberTest == ++nT || numberTest == 0) {
		Expr e(Tg(Cotg(a)));
		T.test(e.diff(a), "1/(Sin(a)^2Cos(Cotg(a))^2)", __LINE__, nT);
	}
	if (numberTest == ++nT || numberTest == 0) {
		Expr e(a+a*b+a*b*a*c-3*a*c);
		T.test(e.diff(a), "1+b-3c+2abc", __LINE__, nT);
	}
	if (numberTest == ++nT || numberTest == 0) {
		Expr e(0);
		T.test(e.diff(a),"0",__LINE__, nT);
	}
	if (numberTest == ++nT || numberTest == 0) {
		Expr e(Sin(a*(Ln(b)^b))+2-a);
		T.test(e.diff(c), "0", __LINE__, nT);
	}
	if (numberTest == ++nT || numberTest == 0) {
		Expr e(Tg(a));
		T.test(e.diff(a), "Cos(a)^(-2)", __LINE__, nT);
	}
//--- 		
	if (numberTest == ++nT || numberTest == 0) {
		Expr e(4*a*b/(a+b));
		T.test(e.diff(a), "4(b/(a+b)-ab/(a+b)^2)", __LINE__, nT);
	}
	if (numberTest == ++nT || numberTest == 0) {
		Expr e(-8*a*b/(-a*b+b));
		T.test(e.diff(a), "-8(b/(b-ab)+ab^2/(b-ab)^2)", __LINE__, nT);
	}
	if (numberTest == ++nT || numberTest == 0) {
		Expr e(-a/b*Sin(a));
		T.test(e.diff(a), "-Sin(a)/b-aCos(a)/b", __LINE__, nT);
	}
	if (numberTest == ++nT || numberTest == 0) {
		Expr e(-a/b*Sin(-a));
		T.test(e.diff(a),"-Sin(-a)/b+aCos(-a)/b",__LINE__, nT);
	}
	if (numberTest == ++nT || numberTest == 0) {
		Expr e(a+Cos(a));
		T.test(e.diff(a), "1-Sin(a)", __LINE__, nT);
	}
	if (numberTest == ++nT || numberTest == 0) {
		Expr e(Ln(-a));
		T.test(e.diff(a), "-1/a", __LINE__, nT);
	}
	if (numberTest == ++nT || numberTest == 0) {
		Expr e(Tg(Cos(2*a+b)));
		T.test(e.diff(a), "-2Sin(2a+b)/Cos(Cos(2a+b))^2", __LINE__, nT);
	}
	if (numberTest == ++nT || numberTest == 0) {
		Expr e(a^4);
		T.test(e.diff(a), "4a^3", __LINE__, nT);
	}
	if (numberTest == ++nT || numberTest == 0) {
		Expr e((-a)^(-5));
		T.test(e.diff(a),"5/a^6",__LINE__, nT);
	}
	if (numberTest == ++nT || numberTest == 0) {
		Expr e((-a)^(-6));
		T.test(e.diff(a), "-6/a^7", __LINE__, nT);
	}
	if (numberTest == ++nT || numberTest == 0) {
		Expr e(a);
		T.test(e.diff(a),"1",__LINE__, nT);
	}
	if (numberTest == ++nT || numberTest == 0) {
		Expr e(a);
		T.test(e.diff(-a), "1", __LINE__, nT);
	}
	if (numberTest == ++nT || numberTest == 0) {
		Expr e(-a);
		T.test(e.diff(a),"-1",__LINE__, nT);
	}
	if (numberTest == ++nT || numberTest == 0) {
		Expr e(-a);
		T.test(e.diff(-a), "-1", __LINE__, nT);
	}
	
}
